package com.djl.zenithbite.controller.shopping;

import com.djl.zenithbite.common.response.BaseResponse;
import com.djl.zenithbite.dto.request.FoodAddRequest;
import com.djl.zenithbite.entity.Product;
import com.djl.zenithbite.service.shopping.food.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/food")
public class FoodController {

    @Autowired
    private FoodService foodService;

    @PostMapping("/add")
    public BaseResponse<Product> addFood(@RequestBody FoodAddRequest request){
        return foodService.addFood(request);
    }

    @PostMapping("/edit")
    public BaseResponse<Product> editFood(@RequestBody FoodAddRequest request){
        return foodService.edit(request);
    }

    @GetMapping("/list")
    public BaseResponse<List<Product>> listFood(Integer storeId){
        return foodService.list(storeId);
    }
}
